﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="A_Daili.aspx.cs" Inherits="WAD.WEB.Passport.a_daili" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>推广代理-管理后台</title>
    <link href="css/css.css" rel="stylesheet" type="text/css" />
    <link href="css/base.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.7.1.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <script src="js/Pager.js" type="text/javascript"></script>
    <script src="js/Toast.js" type="text/javascript"></script>
    <style type="text/css">   
    #user_ad {margin-top: 13px;color: #333;font-size: 16px;font-weight: 100;}
    .bodyone{width: 1000px;background-color: White;margin-left: auto;margin-right: auto;overflow: hidden;margin-top: 6px;min-height:870px;margin-bottom: 10px;}
    .main{width: 970px;margin-left: auto;margin-right: auto;overflow: hidden;margin-top: 20px;}
    .tabs{text-align: center;}
    .tabs tr{height: 60px;}
    .table1{border-collapse: collapse;border: 1px solid #EDEDED;}
    .contentquerytab>tbody>tr{border: 0; }
    .contentquerytab>tbody>tr>td{border: 0;}
    .table1 th, tr, td{border: 1px solid #EDEDED;text-align:center;font-size: 16px;}
    .table1 td{ color:#666; text-align:center; }
    .table1 .tdl{ padding-left: 15px; text-align:left;}
    .tab_nav{width:970px; margin:15px 15px 0 15px;}
    .pager_style{ margin-left:15px;}
    .contenthead{width: 940px;height: 60px;margin-left: auto;margin-right: auto;margin-top: 6px;overflow: hidden;background-color: #E4E4E4;padding-left: 30px;}
    .contentquerytab{border-collapse: collapse;}
    .contentquerytab tr{width: 960px;height: 64px;text-align: center;}
    .query { border: 1px solid #EDEDED;border-bottom:0;width: 968px;margin-left: auto;margin-right: auto;margin-top: 15px;}
    .collect{float: left;margin-left: 50px;    font-weight: 600;}
    .collect img{ margin-right:10px;}
    </style>
    <script>
        var pager = new Pager();
        var pager2 = new Pager();
        var old1, old2, old3;
        var page2 = 1;
        $(document).ready(function () {
            $(".tab_li").bind("click", function () {
                $(".tab_li").removeClass("tab_li_ck");
                $(this).addClass("tab_li_ck");
                tab_ck($(this).attr("tag")); //在此添加点击事件
            });
            GetList(1);
        });

        var tag_cerent = 2;
        function tab_ck(tag) {
            tag_cerent = tag.replace("tab", "");
            $("#tab1").addClass("none");
            $("#tab2").addClass("none");
            $("#tab3").addClass("none");
            $("#" + tag).removeClass("none");

            clearValue();
            if (tag_cerent == "1")
                GetList_FL(1);  //客户列表
            else
                GetList(1); //返利列表
        }

        //显示列表
        function GetList(page) {
            if (wait.isShow) return;
            $(".ad_money").html("0");
            $(".fl_money").html("0");
            var param = { sitename: $("#sitename_2").val(), uid: $("#uid_2").val(), page: page, modelid: tag_cerent };
            if (tag_cerent == 3)
                param = { sitename: $("#sitename_3").val(), uid: $("#uid_3").val(), page: page, modelid: tag_cerent };

            if (old1 == param.sitename && old2 == param.uid && old3 == param.page) {
                //setTimeout('clearValue()', 3000);                
                //return;
            }

            $.get("ajax/fc.ashx?getrecordlist", param, function (json) {
                old1 = param.sitename;
                old2 = param.uid;
                old3 = param.page;
                var tbody = $("#tbody_tab" + tag_cerent);
                $(tbody).empty();
                $(".pager_style").removeClass("none");
                if (json.code != 0) {
                    $(tbody).append("<tr><td colspan=6>" + json.msg + "</td></tr>");
                    $(".pager_style").addClass("none");
                    return;
                }
                var list = json.item.table;

                if (list.length == 0) {
                    $(tbody).append("<tr><td colspan='6' style='text-align:center'>没有记录</td></tr>");
                }

                $(json.item.table).each(function () {
                    var title = this.title;
                    //                    if (tag_cerent == 3)
                    //                        title = this.remark;
                    var discount = (this.discount == null ? 0 : this.discount) * 0.01;
                    var amount = (parseFloat(parseFloat(this.op_total * this.op_price * discount).toFixed(2)));
                    if (discount <= 0) amount = 0;
                    $(tbody).append("<tr><td>" + this.by_user_id + "</td>" +
                    "<td class='tdl'>" + this.nick_name + "</td>" +
                    "<td>" + this.op_total + "/" + (this.op_total-this.op_remainder) + "<br /></td>" +
                    "<td>" + (this.op_total * this.op_price) + "<br /></td>" +
                    "<td class='tdl'>" + amount + "</td>" +
                    "<td class='tdl'>" + title + "</td></tr>");
                });
                pager.initPage(page, json.item.itemCount, json.item.pageSize, 5, GetList);
            }, "json");

            if (page == 1) {
                $.get("ajax/fc.ashx?gettotal", param, function (json) {
                    if (json.item != null) {
                        $(".ad_money").html(json.item.ad_money);
                        $(".fl_money").html(json.item.fl_money);
                    }
                }, "json");
            }
        }

        //客户列表
        function GetList_FL(page2) {
            if (wait.isShow) return;
            var param = { sitename: $("#sitename").val(), uid: $("#uid").val(), page: page2, modelid: tag_cerent };
            $.get("ajax/fc.ashx?getclientlist", param, function (json) {
                old1 = param.sitename;
                old2 = param.uid;
                old3 = param.page;
                var tbody = $("#tbody_tab1");
                $(tbody).empty();
                $(".pager_style").removeClass("none");
                if (json.code != 0) {
                    $(tbody).append("<tr><td colspan=6>" + json.msg + "</td></tr>");
                    $(".pager_style").addClass("none");
                    return;
                }
                var list = json.item.table;

                if (list.length == 0) {
                    $(tbody).append("<tr><td colspan='6' style='text-align:center'>没有记录</td></tr>");
                }
                for (var i in list) {
                    $(tbody).append("<tr><td>" + list[i].id + "</td>" +
                    "<td class='tdl'>" + list[i].nick_name + "</td>" +
                    "<td>" + list[i].phone + "<br /></td>" +
                    "<td class='tdl'>" + (list[i].state == true ? "正常" : "禁用") + "</td>" +
                    "<td>" + list[i].date.replace("T"," ").substring(0,19) + "</td></tr>");
                }
                pager2.initPage(page2, json.item.itemCount, json.item.pageSize, 5, GetList_FL);
            }, "json");
        }

        function search(tab) {
            $(".tab_li").eq(tab).click();
        }
        function clearValue() {
            old1 = "";
            old2 = "";
            old3 = "";
        }  
    </script>
</head>
<body>
    <!--#include file="uc/top.html" -->
    <div class="bodyone">
       <div class="contenthead">
           <div id="user_ad"></div>
       </div>
        <div class="tab_nav">
            <ul class="tab_ul">
                <li tag="tab1" class="tab_li">推广客户</li>
                <li tag="tab2"  class="tab_li tab_li_ck" >推广代理</li>
                <li tag="tab3" class="tab_li">推广运营</li>
            </ul>
        </div>
        <form id="form1" runat="server">
        <div class="main" id="main0">
            <div id="tab1" class="none">
             <div class="query">
                <table class="contentquerytab"  >
                    <tbody>
                        <tr>
                            <td colspan="2" style="width: 320px;">
                                <div>
                                    客户编号&nbsp;
                                    <input type="text" style="width: 186px; height: 32px; vertical-align: middle; padding-left: 2px;
                                        line-height: 30px;" name="uid" id="uid" value="">
                                </div>
                            </td>
                            <td colspan="2" style="width: 320px;">
                                <div>
                                    &nbsp;名称&nbsp;
                                    <input type="text" style="width: 186px; height: 32px; vertical-align: middle; padding-left: 2px;
                                        line-height: 30px;" name="sitename" id="sitename" value="">
                                </div>
                            </td>
                            <td colspan="2" style="width: 320px;">
                                <input type="button" id="btn" value="搜 索" style="float: right;margin-right: 60px; width: 122px; height: 43px; font-size: 18px;
                                    color: White; background-color: #6AC7E8; border: 1px solid #ccc; cursor: pointer;"
                                    onclick="search(0)">
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>

                <table class="table1" id="con_row_1">      
                        <tr style="text-align: center; color: #56555A; height: 60px; border: 1px solid  red;">
                            <th style="width: 180px;">客户编号</th>
                            <th style="width: 153px;">名称</th>
                            <th style="width: 150px;">手机</th>
                            <th style="width: 105px;">状态</th>
                            <th style="width: 382px; text-align: left; padding-left: 10px;">注册时间</th>
                        </tr>
                   
                   <tbody id="tbody_tab1" class="tabs">                         
                    </tbody> 
                </table>
            </div>
            
            <div id="tab2" class="div_list_up">
                <div class="query">
                <table class="contentquerytab"  >
                    <tbody>
                <tr>
                    <td colspan="2" style="width: 320px;">
                        <div>
                            客户编号&nbsp;
                            <input type="text" style="width: 186px; height: 32px; vertical-align: middle; padding-left: 2px;
                                line-height: 30px;" name="uid" id="uid_2" value="">
                        </div>
                    </td>
                    <td colspan="2" style="width: 320px;">
                        <div>
                            &nbsp;名称&nbsp;
                            <input type="text" style="width: 186px; height: 32px; vertical-align: middle; padding-left: 2px;
                                line-height: 30px;" name="sitename" id="sitename_2" value="">
                        </div>
                    </td>
                    <td colspan="2" style="width: 320px;">
                        <input type="button" id="Button1" value="搜 索" style="float: right;margin-right: 60px; width: 122px; height: 43px; font-size: 18px;
                            color: White; background-color: #6AC7E8; border: 1px solid #ccc; cursor: pointer;"
                            onclick="search(1)">
                    </td>
                </tr>

                <tr style="border-top: 1px solid #EDEDED;">
                <td colspan="3" style="border-right: 1px solid #EDEDED;"> 
                    <div class="collect"><img src="img/jine.jpg" />金额汇总:<span class="ad_money">0</span>
                    </div>
                    </td>
                <td colspan="3"> 
                <div class="collect"><img src="img/fanli.jpg" />返利汇总: <span class="fl_money">0</span></div>
                    </td>
                </tr>
                </tbody>
                </table>
                </div>

                <table class="table1" id="con_row_2">
                    <tr style="text-align: center; color: #56555A; height: 60px; border: 1px solid  red;">
                        <th style="width: 90px;">客户编号</th>
                        <th style="width: 125px;">名称</th>
                        <th style="width: 115px; ">总数/已分享数</th>
                        <th style="width: 80px;">广告金额</th>
                        <th style="width: 59px;">返利</th>
                        <th style="width: 480px;">广告标题</th>
                    </tr>
                    <tbody id="tbody_tab2" class="tabs">
                    </tbody>
                </table>
            </div>

            <div id="tab3" class="none">
                <div class="query">
                <table class="contentquerytab"  >
                    <tbody>
                <tr>
                    <td colspan="2" style="width: 320px;">
                        <div>
                            客户编号&nbsp;
                            <input type="text" style="width: 186px; height: 32px; vertical-align: middle; padding-left: 2px;
                                line-height: 30px;" name="uid" id="uid_3" value="">
                        </div>
                    </td>
                    <td colspan="2" style="width: 320px;">
                        <div>
                            &nbsp;名称&nbsp;
                            <input type="text" style="width: 186px; height: 32px; vertical-align: middle; padding-left: 2px;
                                line-height: 30px;" name="sitename_3" id="sitename_3" value="">
                        </div>
                    </td>
                    <td colspan="2" style="width: 320px;">
                        <input type="button" id="Button2" value="搜 索" style="float: right;margin-right: 60px; width: 122px; height: 43px; font-size: 18px;
                            color: White; background-color: #6AC7E8; border: 1px solid #ccc; cursor: pointer;"
                            onclick="search(2)">
                    </td>
                </tr>

                <tr style="border-top: 1px solid #EDEDED;">
                <td colspan="3" style="border-right: 1px solid #EDEDED;"> 
                    <div class="collect"><img src="img/jine.jpg" />金额汇总:<span class="ad_money">0</span>
                    </div>
                    </td>
                <td colspan="3"> 
                <div class="collect"><img src="img/fanli.jpg" />返利汇总: <span class="fl_money">0</span></div>
                    </td>
                </tr>
                </tbody>
                </table>
                </div>
                <table class="table1" id="con_row_3">
                    <tr style="text-align: center; color: #56555A; height: 60px; border: 1px solid  red;">
                        <th style="width: 90px;">客户编号</th>
                        <th style="width: 125px;">名称</th>
                        <th style="width: 115px; ">总数/已分享数</th>
                        <th style="width: 80px;">广告金额</th>
                        <th style="width: 59px; ">返利</th>
                        <th style="width: 480px;">广告标题</th>
                    </tr>
                    <tbody id="tbody_tab3" class="tabs">
                    </tbody>
                </table>
            </div>
        </div>

        <div class="pager_style">
                    <ul class="page_num"></ul>
                    <ul class="page_info">
                        <li>总数:<span id="count">50</span></li>
                        <li>每页:<span id="pageSize">10</span></li>
                        <li>页数:<span id="pageToal">5</span></li>
                    </ul>
                </div>
        </form>
    </div>
      <!--#include file="uc/Footer_Agent.html" -->
</body>
</html>
